#!/bin/bash
##########################################
# compact raw viewlog from format of 
#   1. UserCode
#   2. StartTime
#   3. EndTime
#   4. ServiceType
#   5. ChannelCode
#   6. ChannelName
#   7. ProgramName
#   8. MediaCode
#   9. ShiftDuration
#   10.Flux
#   11.EndReason
#   12.ChargeType
#   13.Qos
#   14.PricePlanID
#   15.ProgramID
# to following format
#   1. UserCode
#   2. StartTime
#   3. EndTime
#   4. ServiceType
#   5. MediaCode
###########################################

BEGIN {
    FS = "|"
    OFS = "|"
}

{ 
    if ($4 == 1) {
#        print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15
        print $1,$2,$3,$8
    }
}
